package j2025.j06;

/**
 * @Author 猫大仙
 */
public class j0609 {
    public boolean canJump(int[] nums) {
        int n = nums.length;
        int left = 0,right = 0;
        int rightMax = 0;
        while(left<=right){
            for (int i = left; i <= right; i++) {
                rightMax = Math.max(rightMax,i+nums[i]);
                if(rightMax >= n-1){
                    return true;
                }
            }
            left = right+1;
            right = rightMax;
        }
        return false;
    }
}
